#include "SaveTrigger.h"
#include "GameApp.h"

//-------------------------------------------------------------------------------------
SaveTrigger::SaveTrigger(const float x, const float y, const float z)
	: BaseTrigger()
{
	mpOgreInitData->pos = Ogre::Vector3(x, y, z);
	mTypes.push_front(OBJECT_SAVETRIGGER);
}
//-------------------------------------------------------------------------------------
SaveTrigger::~SaveTrigger(void)
{
}
//-------------------------------------------------------------------------------------
void SaveTrigger::collision(BaseObjectPtr obj, btVector3 &point)
{
	if ((obj->getType() != OBJECT_PLAYER) || dead()) return;

	btVector3 &pos = mpBody->getWorldTransform().getOrigin();
	gpApp->mpGameLogic->saveSaveGame(pos.x(), pos.y(), pos.z(), true);

	kill();
}